package com.flight.view.components;

import javax.swing.*;
import java.awt.*;

/**
 * 统一消息弹窗组件（封装 JOptionPane，简化调用）
 */
public class MessageDialog {
    // 信息提示弹窗
    public static void showInfo(Component parent, String message) {
        JOptionPane.showMessageDialog(parent, message, "提示", JOptionPane.INFORMATION_MESSAGE);
    }

    // 错误提示弹窗
    public static void showError(Component parent, String message) {
        JOptionPane.showMessageDialog(parent, message, "错误", JOptionPane.ERROR_MESSAGE);
    }

    // 确认弹窗（返回true表示确认，false表示取消）
    public static boolean showConfirm(Component parent, String message) {
        int result = JOptionPane.showConfirmDialog(parent, message, "确认", JOptionPane.YES_NO_OPTION);
        return result == JOptionPane.YES_OPTION;
    }
}